<div class="row">
  <div class="col-md-6 col-sm-8 col-sm-push-2">
    <form action="#" method="post" class="form form-horizontal" [formGroup]="siteForm" (ngSubmit)="onSubmit()">
      <div class="one-form-header"></div>
      <div class="one-form-body">
        <div class="form-group">
          <label for="site_add_regionCode" class="col-xs-3 control-label"><span style="color: red;">*</span> 行政区划:</label>
          <div class="col-xs-9">
            <input type="hidden" class="form-control" id="site_add_regionCode" formControlName="regionCode">
            <nz-cascader
              nzSize="large"
              nzPlaceHolder = "请选择行政区划"
              [nzOptions] = "regionsArr"
              nzLabelProperty = 'name'
              nzValueProperty = 'id'
              [nzChangeOnSelect] = 'true'
              [formControlName]="'regionCode'"
            >
            </nz-cascader>
            <!--<input type="text" class="form-control" placeholder="行政区划" id="site_add_regionName"formControlName="regionName" maxlength="10" readonly>-->
            <div *ngIf="formErrors.regionCode" class="has-error">
              <label class="control-label"><i class="fa fa-times-circle-o"></i>{{formErrors.regionCode}} </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-xs-3 control-label">所属机构类型:</label>
          <div class="col-xs-9" >
            <select class="multiselect form-control" (change) = 'entOrGovChange(orgType)' #orgType [formControlName]="'orgType'">
              <option value="1">政府</option>
              <option value="2">企业</option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-xs-3 control-label"><span style="color: red;">*</span> 企业/机构:</label>
          <div class="col-xs-9">
            <!--<input type="hidden" class="form-control" id="site_add_orgId" formControlName="orgId" >-->
            <nz-select style="width: 100%;" nzSize="large"
                       nzAllowClear
                       nzNotFoundContent = '找不到数据'
                       [nzShowSearch] = 'true'
                       [formControlName]="'orgId'">
              <nz-option nzLabel="--选择企业/机构--" nzValue=""></nz-option>
              <nz-option
                *ngFor="let govOrCom of govOrCompany"
                [nzLabel]="govOrCom.name"
                [nzValue]="govOrCom.id"
              >
              </nz-option>
            </nz-select>
            <!--<input type="text" class="form-control" placeholder="企业/机构" id="site_add_orgName" formControlName="orgName" readonly>-->
          </div>
        </div>
        <div class="form-group">
          <label for="site_add_siteName" class="col-xs-3 control-label"><span style="color: red;">*</span> 站点名字:</label>
          <div class="col-xs-9">
            <input type="hidden" id="id" formControlName="id" name="id">
            <input type="text" class="form-control" placeholder="站点名字" id="site_add_siteName" required formControlName="siteName">
            <div *ngIf="formErrors.siteName" class="has-error">
              <label class="control-label"><i class="fa fa-times-circle-o"></i>{{formErrors.siteName}} </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label for="site_add_address" class="col-xs-3 control-label"><span style="color: red;">*</span> 站点位置:</label>
          <div class="col-xs-9">
            <input type="text" class="form-control" placeholder="站点位置" id="site_add_address"formControlName="address" maxlength="50">
            <div *ngIf="formErrors.address" class="has-error">
              <label class="control-label"><i class="fa fa-times-circle-o"></i>{{formErrors.address}} </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-xs-3 control-label" ><span style="color: red;">*</span> 站点类型:</label>
          <div class="col-xs-9">
            <!-- 下拉框 -->
            <nz-select style="width: 100%;" nzSize="large"
                       nzAllowClear
                       nzNotFoundContent = '找不到数据'
                       [nzShowSearch] = 'true'
                       [formControlName]="'siteTypeCode'">
              <nz-option nzLabel="--请选择站点类型--" nzValue=""></nz-option>
              <nz-option
                *ngFor="let category of categorys"
                [nzLabel]="category.cateName + ' - '+ category.siteTypeName"
                [nzValue]="category.siteTypeCode"
              >
              </nz-option>
            </nz-select>
            <!--<select class="multiselect" id="monitor_add_siteTypeCode" class="form-control" formControlName="siteTypeCode" required>-->
            <!--<option value="">&#45;&#45; 请选择站点类型 &#45;&#45;</option>-->
            <!--<option *ngFor="let category of categorys" [value]="category.siteTypeCode">{{category.remark}}</option>-->
            <!--</select>-->
          </div>
        </div>
        <div class="form-group">
          <label for="site_add_linkMan" class="col-xs-3 control-label">站点联系人:</label>
          <div class="col-xs-9">
            <input type="text" class="form-control" placeholder="站点联系人" id="site_add_linkMan"formControlName="linkMan" maxlength="10">
            <div *ngIf="formErrors.linkMan" class="has-error">
              <label class="control-label"><i class="fa fa-times-circle-o"></i>{{formErrors.linkMan}} </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label for="site_add_contactTel" class="col-xs-3 control-label">站点联系电话:</label>
          <div class="col-xs-9">
            <input type="text" class="form-control" placeholder="站点联系电话" id="site_add_contactTel"formControlName="contactTel" maxlength="14">
            <div *ngIf="formErrors.contactTel" class="has-error">
              <label class="control-label"><i class="fa fa-times-circle-o"></i>{{formErrors.contactTel}} </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-xs-3 control-label">是否属第三方:</label>
          <div class="col-xs-9" >
            <div class="row">
              <div class="col-xs-4">
                <input type="radio" id="site_isThied_yes" value="1" formControlName="isThied">
                <label for="site_isThied_yes">
                  是
                </label>
              </div>
              <div class="col-xs-4">
                <input type="radio"  formControlName="isThied" id="site_isThied_no" checked value="0">
                <label for="site_isThied_no">
                  否
                </label>
              </div>
            </div>
          </div>
        </div>

        <div class="form-group">
          <label class="col-xs-3 control-label">是否为移动设备:</label>
          <div class="col-xs-9" >
            <div class="row">
              <div class="col-xs-4">
                <input type="radio" id="site_isMove_yes" value="1" formControlName="isMove">
                <label for="site_isMove_yes">
                  是
                </label>
              </div>
              <div class="col-xs-4">
                <input type="radio"  formControlName="isMove" id="site_isMove_no" checked value="0">
                <label for="site_isMove_no">
                  否
                </label>
              </div>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-xs-3 control-label">是否启用:</label>
          <div class="col-xs-9" >
            <div class="row">
              <div class="col-xs-4">
                <input type="radio" id="site_isUse_yes" value="1" formControlName="isUse">
                <label for="site_isUse_yes">
                  启用
                </label>
              </div>
              <div class="col-xs-4">
                <input type="radio"  formControlName="isUse" id="site_isUse_no" checked value="0">
                <label for="site_isUse_no">
                  禁用
                </label>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="one-form-footer">
        <div class="pull-right">
          <button class="btn btn-default" type="reset" (click)="cancelSiteAdd()">取消</button>
          <button class="btn btn-success" type="submit" [disabled]='!siteForm.valid'>保存</button>
          <button class="btn btn-success" type="button"
                  *ngIf="siteForm.value.isMove !== '1'" (click)="assignDevice()" [disabled]="!siteForm.valid">绑定设备</button>
          <button class="btn btn-success" type="button"
                  *ngIf="siteForm.value.isMove === '1'" (click)="createSiteRange()" [disabled]="!siteForm.valid">创建站点区间</button>
        </div>
      </div>
    </form>
  </div>
</div>
